const fs = require(`fs`)
const path = require(`path`)
// 原生读取方式
fs.readFile(path.join(__dirname,`1.txt`),(error,data)=> {
    if (error) {
       console.log(error);
   }else{
        console.log(data.toString());
        fs.readFile(path.join(__dirname, `2.txt`), (error,data1) => {
            if (error) {
                console.log(error);
            } else {
                console.log(data1.toString());
                const result = data.toString() + `\n` + data1.toString()
                fs.writeFile(path.join(__dirname, `3.txt`), result, (error, data) => {
                    if (error) {
                        console.log(error);
                    } else {
                        console.log("写入成功");
                    }
                })
            }
        })
   }
})
